<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "express_show_list".
 *
 * @property int $id
 * @property int $icon
 * @property string $name
 * @property float $old_price
 * @property float $price
 * @property int $sort
 */
class ExpressShowList extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'express_show_list';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['icon', 'sort'], 'integer'],
            [['name'], 'required'],
            [['old_price', 'price'], 'number'],
            [['name'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'icon' => 'Icon',
            'name' => 'Name',
            'old_price' => 'Old Price',
            'price' => 'Price',
            'sort' => 'Sort',
        ];
    }

    public function getImage()
    {
        return $this->hasOne(Images::class, ['id' => 'icon']);
    }
}
